<?php
namespace App\Console; use App\System; use Carbon\Carbon; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Schema; class Kernel extends ConsoleKernel { protected $commands = array(); protected function schedule(Schedule $spd0d724) { if (!app()->runningInConsole()) { return; } try { System::_init(); } catch (\Throwable $sp7900a2) { return; } if (System::_getInt('order_clean_unpay_open') === 1) { $spc9ad9e = System::_getInt('order_clean_unpay_day', 7); $spd0d724->call(function () use($spc9ad9e) { echo '[' . date('Y-m-d H:i:s') . "] cleaning unpaid orders({$spc9ad9e} days ago)...\n"; \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new Carbon())->addDays(-$spc9ad9e))->delete(); $spdbd7f3 = '[' . date('Y-m-d H:i:s') . '] unpaid-orders cleaned 
'; echo $spdbd7f3; })->dailyAt('01:00'); } $spd0d724->call(function () { $spc9ad9e = 7; echo '[' . date('Y-m-d H:i:s') . "] cleaning deleted cards({$spc9ad9e} days ago)...\n"; \App\Card::onlyTrashed()->where('deleted_at', '<', (new Carbon())->addDays(-$spc9ad9e))->forceDelete(); $spdbd7f3 = '[' . date('Y-m-d H:i:s') . '] deleted-cards cleaned
'; echo $spdbd7f3; })->dailyAt('02:00'); } protected function commands() { $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } }